/*
 * Qinlan Shen
 * November 8, 2010
 * Pd. 8
 * 
 * Abstract class for all scripts.  All scripts should have a run function that is unique to the
 * script.  Scripts can also end.
 * 
 */

import java.awt.*;
import java.util.*;

public abstract class RoseScript
{	
	protected int time;
	protected int difficulty;
	protected boolean cleared;
	public abstract ArrayList<PointItem> run(Rose rose, Character player, int frame, ArrayList<Enemy> enemies, ArrayList<PointItem> points, ArrayList<Image> packets, Image point);
	
	public RoseScript(int d, int t)
	{
		time = t;
		difficulty = d;
	}
	
	public ArrayList<PointItem> endScript(Image p, Rose rose, Character player, ArrayList<Enemy> enemies)
	{
		ArrayList<PointItem> allPoints = new ArrayList<PointItem>();
		rose.incrementScript();
		for (int i = 0; i < rose.getNumCurrentScript() * 5; i++)
		{
			allPoints.add(new PointItem(p, 5, rose.getX(), rose.getY(), (int)(Math.random() * rose.getNumCurrentScript() * 100), 2, 5000));
		}
		return allPoints;
	}
	
	public ArrayList<Enemy> clearScript(Rose rose)
	{
		ArrayList enemies = new ArrayList<Enemy>();
		enemies.add(rose);
		return enemies;
	}
	
	public void incrementTime(int frame)
	{
		if (frame % 60 == 0 && frame != 0)
			time--;
	}
	
	public int getTime()
	{
		return time;
	}
	
}